const endpoint = 'http://192.168.14.147:9001';


module.exports = {
    endpoint,

    body: {
        noLogin: {
            code: 0,
            message: '登录保护，请重新登录！'
        },
        success(message = '') {
            return {
                code: 1,
                message
            }
        },
        error(message = '') {
            return {
                code: -1,
                message
            }
        },
        data(data) {
            return {
                code: 1,
                message: '',
                data
            }
        },
        page(page = 1, pageSize=10, total) {
            const body = {
                code: 1,
                message: '',
                data: {
                    page,
                    pageSize,
                }
            }
            if (total) body.data.total = total;
            return body;
        }
    },

    async login(session) {
        return await session.post(`${endpoint}/api/users/login`)
            .send({ account: 'admin', password: '123' });
    }
}